package com.example.yourapp;

import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private WebView webView;

        @Override
            protected void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                            setContentView(R.layout.activity_main);

                                    webView = findViewById(R.id.webview);
                                            WebSettings webSettings = webView.getSettings();
                                                    webSettings.setJavaScriptEnabled(true); // 启用JavaScript

                                                            // 加载本地HTML文件
                                                                    webView.loadUrl("file:///android_asset/index.html");
                                                                        }
                                                                        }